package com.river;

import com.alibaba.dubbo.config.ApplicationConfig;
import com.alibaba.dubbo.config.ReferenceConfig;
import com.alibaba.dubbo.config.RegistryConfig;

/**
 * Created by jl on 2018/3/21.
 */
public class Consumer {
    public static void main(String[] args) {
        ApplicationConfig applicationConfig = new ApplicationConfig();
        applicationConfig.setName("consumer-hello");

        RegistryConfig registryConfig = new RegistryConfig();
        registryConfig.setAddress("zookeeper://172.168.1.122:41802");
        registryConfig.setUsername("");
        registryConfig.setPassword("");

        ReferenceConfig<IDemoService> referenceConfig = new ReferenceConfig<IDemoService>();
        referenceConfig.setApplication(applicationConfig);
        referenceConfig.setRegistry(registryConfig);
        referenceConfig.setInterface(IDemoService.class);
        referenceConfig.setVersion("1.0.0");

        IDemoService demoServiceProxy = referenceConfig.get();
        System.out.println(demoServiceProxy.getGreeting());
    }
}
